<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:conv="clr-namespace:QuickZip.Converters"            
    xmlns:local="clr-namespace:QuickZip.UserControls"            
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Templates.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="BaseToggleButton" TargetType="{x:Type ToggleButton}">
        <Border x:Name="border"
                Padding="2,0"
				Background="Transparent" 
				BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="1"				
				SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition MaxHeight="11"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Rectangle x:Name="UpperHighlight" Fill="#75FFFFFF" Visibility="Collapsed"/>
                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                              VerticalAlignment="Center" Grid.RowSpan="2" />
            </Grid>

        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="False">
                <Setter TargetName="border" Property="BorderBrush" Value="Transparent" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="border" Property="Background" Value="{StaticResource HotTrackBrush}" />
                <Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="border" Property="Background" Value="{StaticResource PressedBrush}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>


    <Geometry x:Key="ServeMan1">M4,8 L12,8 12,15 4,15 z</Geometry>
    <PathGeometry x:Key="ServeMan2">
        <PathFigure StartPoint="4,8" IsClosed="True">
            <ArcSegment Point="12,8" Size="3,3"  IsLargeArc="False"  />
            <LineSegment Point="9,8" />
            <ArcSegment Point="7,8" Size="2,2" IsLargeArc="True" />
        </PathFigure>
    </PathGeometry>

    <Style x:Key="{x:Type local:DropDownControl}" 
           TargetType="{x:Type local:DropDownControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DropDownControl}">
                    <Grid>
                        <ToggleButton x:Name="PART_ToggleButton" Template="{StaticResource BaseToggleButton}" 
                                      BorderBrush="Silver"  
                                      IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                            <ContentPresenter Content="{TemplateBinding Header}" />
                        </ToggleButton>
                        <Popup x:Name="PART_Popup" Focusable="False"
                               IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, 
                                            RelativeSource={RelativeSource TemplatedParent}}"
                               StaysOpen="False" 
                               HorizontalOffset="0"
                               VerticalOffset="0"
                               Placement="Bottom"  
                               PopupAnimation="Slide" AllowsTransparency="True">
                            <Grid x:Name="PART_DropDown">
                                <Border x:Name="PART_DropDownBorder" 
                                        Background="{DynamicResource WindowBackgroundBrush}" Padding="3"
                                        BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1">
                                    <ContentPresenter x:Name="PART_Content"  Content="{TemplateBinding Content}" />
                                </Border>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDropDownAlignLeft" Value="True">
                            <Setter TargetName="PART_Popup" Property="HorizontalOffset"
                                    Value="{Binding ActualWidth, ElementName=PART_ToggleButton}" />
                            <Setter TargetName="PART_Popup" Property="VerticalOffset"
                                    Value="{Binding ActualHeight, ElementName=PART_ToggleButton}" />
                            <Setter TargetName="PART_Popup" Property="Placement" Value="Left" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
